package com.sghd.football.module.game.service.model;

/**
 * @author wch
 * @date 2018-08-15 15:23
 * @desc
 **/

import com.sghd.common.utils.json.JsonUtils;

import static com.sghd.football.module.game.service.DialogService.*;

/**
 * 弹窗内容
 * */
public enum Window {
    UNKOUNW_ERROR("发生了未知错误，请联系管理员！", WINDOW_F, BT_TOHALL),
    PLAYER_INFO_FAIL("获取玩家信息失败", WINDOW_T, BT_TOHALL),
    MONEY_TOOLOW("金币不足该房间最低要求", WINDOW_T, BT_TOHALL),
    MONEY_TOOMANY("金币已超出该房间限制", WINDOW_T, BT_TOHALL),
    MANEY_LOGIN("您的账号在其它地方登录了,您被挤出游戏,请检查是否是本人行为", WINDOW_T, BT_TOHALL),
    OTHER_ROOM("你当前正处于另一个房间]中", WINDOW_T, BT_TOHALL),
    ROOM_LIMIT("该场已无空位置啦,换个场玩玩", WINDOW_T, BT_TOHALL),
    OP_TIMEOUT("3分钟未操作，您已被强制返回大厅", WINDOW_T, BT_TOHALL),
    SETTLE_FAIL("结算失败", WINDOW_F, BT_TOHALL),
    PLAYER_NOT_FOUND("未找到该玩家", WINDOW_T, BT_TOHALL),
    SERVER_ROTATE("有一次旋转操作还未结束！", WINDOW_T, BT_TOHALL),
    PLAYER_MINIGAME("正在小游戏中！", WINDOW_T, BT_TOHALL),
    NOT_ENOUGH_MONEY("金币不足", WINDOW_F, BT_TOHALL),
    SERVER_CLOSED("服务器维护中....", WINDOW_T, BT_TOHALL),
    PLAYER_ALREADY_INROOM("你已经在这个房间里面", WINDOW_F, BT_TOHALL),
    TOKEN_FIAL("非法连接", WINDOW_T, BT_TOHALL);
    private String content;
    private String type;
    private int func;

    private Window(String content, String type, int func) {
        this.content = content;
        this.type = type;
        this.func = func;
    }

    public String getWindows() {
        ReturnInfo windows = new ReturnInfo();
        windows.setType(type);
        windows.setInfo(content);
        windows.addButton(new Button(func, null));
        return JsonUtils.object2String(windows);
    }

    public String getContent() {
        return content;
    }
}
